package com.mall.application.controller;


import com.mall.application.api.ApplicationApi;
import com.mall.application.entity.param.ApplicationAddParam;
import com.mall.application.entity.param.ApplicationEditParam;
import com.mall.common.entity.ResponseData;
import io.swagger.annotations.*;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author wuyijie
 * @since 2021-06-03
 */
@RestController
@RequestMapping("/applicationApi")
@Api(value = "application 接口", tags = "application 接口")
public class ApplicationController {
    @Resource
    private ApplicationApi applicationApi;


    @RequestMapping(value = "/application", method = RequestMethod.POST)
    @ApiOperation(value = "添加方法", notes = "添加方法1")
    public ResponseData add(@Validated @RequestBody ApplicationAddParam applicationAddParam) {
        return ResponseData.success(applicationApi.add(applicationAddParam));
    }

    @RequestMapping(value = "/application", method = RequestMethod.PUT)
    @ApiOperation(value = "修改方法", notes = "修改方法1")
    public ResponseData edit(@Validated @RequestBody ApplicationEditParam applicationEditParam) {
        return ResponseData.success(applicationApi.edit(applicationEditParam));
    }

}
